package com.zzp.thread.syn;

import java.util.concurrent.CopyOnWriteArrayList;

public class TestJUC {

    public static void main(String[] args) throws InterruptedException {



        CopyOnWriteArrayList<String> lists = new CopyOnWriteArrayList<>();
        for (int i = 0; i < 10000; i++) {
            new Thread(() -> {
                lists.add(Thread.currentThread().getName());
            }).start();
        }

        Thread.sleep(1000);

        System.out.println("集合大小为：" +  lists.size());
    }
}
